<!DOCTYPE html>
<html>
{include file="head.html"}

<body>

<div class="fullscreen">

<div class="topfixed">
      <div class="t_left"><a href="/index.php" class="goBack"><i class="back"></i></a></div>
      <div class="t_main">兼职</div>
      <div class="t_right"><a href="/index.php?m=job&a=add" class="link">发布</a></div>
   
    </div> 
 <div class="paddingheight" style="height:50px;"></div>
 <div class="comblock" style="position:relative;">
 	<div class="tab-select ">
    		<div class="item" id="tab-category-box" to="category-box"><span class="t">全部分类</span> <i class="t3down "></i><b></b></div>
            
            <div class="item" id="tab-scarea-box" to="scarea-box"><span class="t">区域</span> <i class="t3down"></i><b></b></div>
            	
    		 
    		<div class="item" id="tab-choice-box" to="choice-box"><span class="t">筛选</span> <i class="t3down"></i></div>
    </div>
	
    <div id="category-box" name="category" class="tab-select-box">
    	<a class="item" v="">全部</a>
        	{foreach item=c from=$catlist}
                <a class="item" v="{$c.catid}">{$c.cname}</a>
            {/foreach}
         
    </div>
    
    
    
    <div id="scarea-box" name="cityid" class="scarea-box tab-select-box">
    	<a class="item" v="">全部</a>
          {foreach item=c from=$scarea}
                <a class="item" v="{$c.id}">{$c.title}</a>
            {/foreach}
         
    </div>
    
    <div id="choice-box" name="filter" class="choice-box tab-select-box">
    	<a class="item" v="">全部</a>
    	<a class="item" v="isrecommend">推荐</a>
        <a class="item" v="isnew">最新</a>
    </div>

  
 </div> 
<div class="comblock">
 
<div class="joblist" id="joblist">
 
          {foreach item=c from=$list}
          <div class="item">
          	<a href="/index.php?m=show&id={$c.id}" class="title">{$c.title} </a>
            <div class="row">薪酬：<span class="money">￥{$c.money}</span> <span class="time">{$c.dateline|timeago}</span></div>
            <div class="address">地址：{$c.address}</div>
            <div class="content">{$c.description}</div>
          
          </div>
            
          {/foreach}
</div>
<div class="pullup" id="loadmore">加载更多</div>
</div>

{include file="footer.html"}
<script id="joblist-tpl" type="text/html">
	<%for(var i=0;i<list.length;i++){%>
	 <div class="item">
          	<a href="/index.php?m=show&id=<%=list[i].id%>" class="title"><%=list[i].title%> </a>
            <div class="row">
				薪酬：<span class="money">￥<%=list[i].money%></span> 
				<span class="time"><%=dateFormat(list[i].dateline,"yyyy-MM-dd")%></span>
			</div>
			<div class="address">地址：<%=list[i].address%></div>
            <div class="content"><%=list[i].description%></div>
          
          </div>
	<%}%>
</script>

<script src="/plugin/jquery/template-native.js"></script>
 <script src="/plugin/skyweb/listload.js"></script>

  <script>
	  var orderby='',catid=0,filter='',cityid=0,first=false;; 
	  var per_page={$per_page};
	 function loadJob(){
		if(per_page==0 && !first){		 
			return false; 
		 }
		$.get('/index.php?m=job&ajax=1&cityid='+cityid+'&catid='+catid+"&orderby="+orderby+"&filter="+filter+"&per_page="+per_page,function(data){
			per_page=data.data.per_page;
			if(per_page==0){
				//skyToast('没有数据了');
				$("#loadmore").hide();
			}else{
				$("#loadmore").show();
			}
			var html=template("joblist-tpl",data.data);
			if(first){
				first=false;
				$("#joblist").html(html);
				
			}else{
				$("#joblist").append(html);
			}
		},"json");
	}
	
	listload.loadid="#loadmore";
	listload.showload(function(){
			loadJob();
	 });

    	$(function(){
			$(document).on("click",".tab-select .item",function(){
				var to=$(this).attr("to");		 
				$("#"+to).toggle().siblings(".tab-select-box").hide();
			});			
			$(document).on("click",".tab-select-box .item",function(){
				$(".tab-select-box").hide();
				var para=$(this).parents(".tab-select-box").attr("name");
				var v=$(this).attr("v");
				per_page=0;
				first=1;
				switch(para){
					case "category":
							catid=v;
						break;
					case "order":
							orderby=v;
						break;
					case "filter":
							filter=v;
						break;
					case "cityid":
							cityid=v;
						break;
				}
				$("#tab-"+$(this).parents(".tab-select-box").attr("id")+" .t").text($(this).text());

				loadJob();
			});
		});
    </script>
</div>
</body>
</html>
